<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width:50px;
            height:100px;
            background-color: pink;
            overflow: scroll;
            border: 3px solid red;
        }
    </style>
</head>
<body>
    <div>测试内容1  测试内容1  测试内容1  测试内容1  </div>
    <script>
        var div = document.querySelector('div');
        console.log(div.scrollHeight);//208 表名内容+padding的宽度为208
        console.log(div.scrollTop); //0 表明没有内容在滚动条上面
        console.log(div.scrollWidth);//33 表名内容+padding的宽度为33
        console.log(div.scrollLeft);//0表名没有内容在滚动条左侧
    </script>
</body>
</html>